function drawSport(arr) {
	d3.selectAll(".scatterCircle").remove();
	d3.selectAll(".scatterText").remove();
	if (arr && arr.length) {
		//
		// svgInfo.scatterText = svgInfo.svg.selectAll("g")
		//     .select("text")
		//     .data(arr)
		//     .enter()
		//     .append11
		//     .text(function(d, e) {
		//         return d.name
		//     })
		//     .attr("class", "scatterText")
		//     .attr("y", function(info) { //每个矩形的起始y坐标
		//         return  (info.y ? (info.y / multiple + svgInfo.width / 2) : (svgInfo.width / 2)) + yOffsetNew + 2
		//     }) //每个矩形的起始x坐标
		//     .attr("x", function(info) { //每个矩形的起始y坐标
		//         return -((info.x ? (svgInfo.height + info.x / multiple) : (svgInfo.height)) + yOffset - 8)
		//     })
		//     .attr("font-size", 12)
		//     .attr("fill", '#6cff01');
		svgInfo.scatterCircle = svgInfo.svg
			.selectAll("circle")
			.data(arr)
			.enter()
			.append("circle")
			.style("fill", "#6cff01")
			.attr("class", "scatterCircle")
			.attr("cy", function(info) { //每个矩形的起始y坐标
				return (info.y ? (info.y / multiple + svgInfo.width / 2) : (svgInfo.width / 2)) + yOffsetNew - 4
			}) //每个矩形的起始x坐标
			.attr("cx", function(info) { //每个矩形的起始y坐标
				return -((info.x ? (svgInfo.height + info.x / multiple) : (svgInfo.height)) + yOffset)
			})
			.attr("r", function(d) {
				return 6;
			})
	}
}

function getWorkStationInfo(i) {
	let {
		arr,
		x,
		y
	} = getWorkAllInfo(i)
	let workArr = []
	if (workStationType == "all") {
		toastText('请先选择工站类型')
	} else {
		arr.map(item => {
			if (item.mold == workStationType) {
				workArr.push(item)
			}
		})
		if (workArr && workArr.length) {
			$('.popup-selectWorkStation .popup-main .popup-img-box').removeClass('img29')
			$('.popup-selectWorkStation .popup-main .popup-img-box').removeClass('img44')
			if (workArr.length > 5) {
				let val = ``
				workArr.map(item => {

					val += `
                    <div class="select-img" >
                        <div></div>
                        <span>${item.value}</span>
                        <i>(${item.mold})</i>
                        <b>${item.type}</b>
                    </div> 
                `
				})
				$('.popup-selectWorkStation .popup-main .popup-img-box').html(val)
				if (i === 29) {
					$('.popup-selectWorkStation .popup-main .popup-img-box').addClass('img29')
				} else if (i === 45 || i === 43 || i === 44|| i === 48) {
					$('.popup-selectWorkStation .popup-main .popup-img-box').addClass('img44')
				}
				$('.popup-selectWorkStation').show()
			} else {
				let pickArr = [],
					val = {}

				let picker = new mui.PopPicker({
					layer: 2
				})
				let list = [];
				workArr.map(item => {
					list = item.type ? locationType(item.type) : [];
					val = {
						value: item.value,
						text: item.value,
						children: list
					}
					pickArr.push(val)
				})
				picker.setData(pickArr)
				picker.show(function(selectItems) {
					let action = selectItems[1].value,
						locationName = selectItems[0].value
					let data = [{
						"operation": action,
						locationName,
						"properties": [{}]
					}]
					if (action === "Charging") {
						// if ((workStationType ==='3T' || workStationType==='16T')){
						//
						// }
						vehiclesType = 1
						getVehiclesName()
					} else {
						// getOrder(data)
						vehiclesType = 4
						orderInfo = data
						getVehiclesName()
					}

				})
			}
		} else {
			toastText('该区域没有' + workStationType + '工站')
		}

	}

}

$('.tips-box .btn-type-list ul li').click(function() {
	$('.new-btn-box .btn-list .pattern-btn').eq(0).siblings().removeClass('active')
	$('.new-btn-box .btn-list .pattern-btn').eq(0).addClass('active')
	$('.new-btn-box .pattern-box .pattern-list').eq(0).siblings().removeClass('active')
	$('.new-btn-box .pattern-box .pattern-list').eq(0).addClass('active')
	let i = $(this).index() + 1
	if (i < 5) {
		if (i == 1) {
			workStationType = '3T'
		}
		if (i == 2) {
			workStationType = '7T'
		}
		if (i == 3) {
			workStationType = '16T'
		}
		if (i == 4) {
			workStationType = '32T'
		}
	} else {
		workStationType = 'all'
	}
	$(this).addClass('active').siblings().removeClass('active')
	$('.main-box .bg-img-box i').eq(i - 1).addClass('active').siblings().removeClass('active')
})

function switchWorkType(info) {
	let val = `<p>类型：</p>	`;
	workStationTypeAll.map(item => {
		let check = ' '
		if (item.value == workStationType) {
			check = 'checked'
		}
		val += `
			<div class="mui-input-row mui-radio">
				<label>${item.text}</label>
				<input name="workStation" type="radio" value="${item.value}" ${check}>
			</div>
		`
	})
	$('.popup-workStation .order-main .order-radio input').val(workStationType)
	$('.popup-workStation .order-main .order-radio').html(val)
	$('.popup-workStation').show()

}
$('.popup-workStation .order-main .order-radio').on('click', '.mui-radio', function(event) {
	let val = $(".popup-workStation .order-main .order-radio input[name='workStation']:checked").val()
	let arr = ['3T', '7T', '16T', '32T'],
		index = 0
	arr.map((item, i) => {
		if (item == val) {
			index = i
		}
	})
	$('.tips-box .btn-type-list ul li').eq(index).addClass('active').siblings().removeClass('active')
	$('.main-box .bg-img-box i').eq(index).addClass('active').siblings().removeClass('active')
	vehiclesType = 5
	workStationType = val
	getVehiclesName()
})
$('.popup-selectWorkStation .popup-main .popup-img-box ').on('click', '.select-img', function(event) {
	let val = $(this).find('span').text(),
		type = $(this).find('b').text()
	let list = type ? locationType(type) : [];
	$(this).addClass('active').siblings().removeClass('active')
	var picker = new mui.PopPicker(),
		work = '';
	getLocations().map(item => {
		if (item.name == val) {
			work = item.siteName
		}
	})
	picker.setData(list);
	picker.show(function(selectItems) {
		action = selectItems[0].value
		let data = [{
			"operation": action,
			"locationName": val,
			"properties": [{}]
		}]
		// getOrder(data)
		vehiclesType = 4
		orderInfo = data
		getVehiclesName()
		$('.popup-selectWorkStation ').hide()

	})
})

function sortRule(properties) {
	return function(a, b) {
		if (a[properties] || b[properties]) {
			return a[properties] - b[properties]; // 如果a>=b，返回自然数，不用交换位置
		} else {
			return
		}
	}


}

function getWorkAllInfo(i) {
	let arr = [],
		x = 0,
		y = 0,
		data = {}
	$.ajax({
		url: `http://${ipValue}:55200/v1/locationByArea?area=${i}`,
		contentType: "application/json",
		params: '',
		type: "get",
		async: !workInfo,
		dataType: "json",
		success: (res) => {
			res.msg.map(item => {
				arr.push({
					value: item.name,
					type: item.type.name,
					mold: item.properties.type,
					order: item.properties.order || 0
				})
			})
		},
		timeout: timeOut,
		error: () => {
			overTime()
		}
	})
	let newArr = arr.sort(sortRule('order'))
	return data = {
		arr,
		x,
		y
	}
	switch (i) {
		case 1:
			// 1-13
			arr = [{
					value: "OP020内封头料框1",
					type: "Rotate",
					x: 65,
					y: 152,
					mold: '3T'
				},
				{
					value: "OP020内封头料框2",
					type: "L_U_R",
					x: 118,
					y: 152,
					mold: '3T'
				},
				{
					value: "OP070工位端框料框1",
					type: "L_U_R",
					x: 172,
					y: 152,
					mold: '3T'
				},
				{
					value: "OP070工位端框料框2",
					type: "L_U_R",
					x: 236,
					y: 152,
					mold: '3T'
				},
				{
					value: "OP070连接圈料框1",
					type: "L_U_R",
					x: 297,
					y: 152,
					mold: '3T'
				},
				{
					value: "OP070连接圈料框2",
					type: "L_U_R",
					x: 355,
					y: 152,
					mold: '3T'
				},
				{
					value: "OP080鞍座上端框料框1",
					type: "L_U_R",
					x: 410,
					y: 152,
					mold: '3T'
				},
				{
					value: "OP090下端框料框1",
					type: "L_U_R",
					x: 467,
					y: 152,
					mold: '3T'
				},
				{
					value: "OP020罐体附件存储区1",
					type: "L_U_R",
					x: 521,
					y: 152,
					mold: '3T'
				},
				{
					value: "OP130鹅颈槽料框1",
					type: "L_U_R",
					x: 587,
					y: 152,
					mold: '3T'
				},
				{
					value: "OP200阀门箱料框1",
					type: "L_U_R",
					x: 653,
					y: 152,
					mold: '3T'
				},
				{
					value: "OP060管帽料框1",
					type: "L_U_R",
					x: 708,
					y: 152,
					mold: '3T'
				},
				{
					value: "OP030八点支撑压盖1",
					type: "L_U_R",
					x: 764,
					y: 152,
					mold: '3T'
				},
				{
					value: "OP020内封头料框3",
					type: "L_U_R",
					x: 65,
					y: 215,
					mold: '3T'
				},
				{
					value: "OP020内封头料框4",
					type: "L_U_R",
					x: 118,
					y: 215,
					mold: '3T'
				},
				{
					value: "OP070工位端框料框3",
					type: "L_U_R",
					x: 172,
					y: 215,
					mold: '3T'
				},
				{
					value: "OP070工位端框料框4",
					type: "L_U_R",
					x: 236,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "OP070连接圈料框3",
					type: "Rotate",
					x: 297,
					y: 215,
					mold: '3T'
				},
				{
					value: "OP070连接圈料框4",
					type: "L_U_R",
					x: 355,
					y: 215,
					mold: '3T'
				},
				{
					value: "OP080鞍座上端框料框2",
					type: "L_U_R",
					x: 410,
					y: 215,
					mold: '3T'
				}, // 11
				{
					value: "OP090下端框料框2",
					type: "L_U_R",
					x: 467,
					y: 215,
					mold: '3T'
				},
				{
					value: "OP020罐体附件存储区2",
					type: "L_U_R",
					x: 521,
					y: 215,
					mold: '3T'
				},
				{
					value: "OP130鹅颈槽料框2",
					type: "L_U_R",
					x: 587,
					y: 215,
					mold: '3T'
				},
				{
					value: "OP200阀门箱料框2",
					type: "L_U_R",
					x: 653,
					y: 215,
					mold: '3T'
				},
				{
					value: "OP060管帽料框2",
					type: "L_U_R",
					x: 708,
					y: 215,
					mold: '3T'
				},
				{
					value: "OP030八点支撑压盖2",
					type: "L_U_R",
					x: 764,
					y: 215,
					mold: '3T'
				},
			];
			x = 13
			y = 50
			break;
		case 2:
			// 27-28
			arr = [{
					value: "OP210-1",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
				{
					value: "OP210-2",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
			]
			break;
		case 3:
			// 29/31
			arr = [{
					value: "OP200-6",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
				{
					// value: "OP200阀门箱料框",
					value: "OP200-6阀门箱料框3T",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
			]
			break;
		case 4:
			// 32 -33
			arr = [{
					value: "OP200-5",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
				{
					// value: "OP200阀门箱料框1",
					value: 'OP200-5阀门箱料框3T',
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				},
			]
			break;
		case 5:
			// 34-35
			arr = [{
					value: "OP200-4",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
				{
					// value: "OP200阀门箱料框2",
					value: 'OP200-4阀门箱料框3T',
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				},
			]
			break;
		case 6:
			// 36/37
			arr = [{
					value: "OP200-3",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
				{
					// value: "OP200阀门箱料框6",
					value: 'OP200-3阀门箱料框3T',
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				},
			]
			break;
		case 7:
			//  38/39
			arr = [{
					value: "OP200-2",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
				{
					// value: "OP200阀门箱料框4",
					value: 'OP200-2阀门箱料框3T',
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				},
			]
			break;
		case 8:
			// 40/41
			arr = [{
					value: "OP200-1",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
				{
					// value: "OP200阀门箱料框5",
					value: 'OP200-1阀门箱料框3T',
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				},
			]
			break;
		case 9:
			// 42/43
			arr = [{
					value: "NP280",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '7T'
				},
				{
					value: "NP280分子筛料框",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				},
			]
			break;
		case 10:
			// 44-46
			arr = [{
					value: "OP020内封头料框5",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				},
				{
					value: "OP020",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
				{
					value: "OP020内封头料框6",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				},
			]
			break;
		case 11:
			// 47
			arr = [{
					value: "OP040罐体八点支撑压盖补强板满焊工位",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				}, //11
			]
			break;
		case 12:
			//48-49
			arr = [{
					value: "OP050",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
				{
					value: "OP050-2",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
			]
			break;
		case 13:
			// 55-56
			arr = [{
					value: "16T外筒体缓存区-2",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
				{
					value: "16T外筒体缓存区-1",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
			]
			break;
		case 14:
			// 50-51
			arr = [{
					value: "16吨充电位",
					type: "Charging",
					x: 110,
					y: 215,
					mold: '16T'
				}, //11
				{
					value: "旋转工位",
					type: "Rotate",
					x: 110,
					y: 215,
					mold: '16T'
				}, //11
			]
			break;
		case 15:
			// 52-54
			arr = [{
					value: "OP060管帽料框中东1",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "OP060-1人工焊接管帽、管线及表面检测工位",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				}, //11
				{
					value: "OP060-2人工焊接管帽、管线及表面检测工位",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				}, //11
			]
			break;
		case 16:
			// 57/58
			arr = [{
					value: "OP190-1油漆后总成缓存区",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				}, //11
				{
					value: "OP190-2油漆后总成缓存区",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				}, //11
			]
			break;
		case 17:
			// 59-60
			arr = [{
					value: "OP080鞍座、上端框料框",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "OP080",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				}, //11
			]
			break;
		case 18:
			// 61-66
			arr = [{
					value: "OP070东跨连接圈料框1",
					type: "Rotate",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "OP070东跨连接圈料框2",
					type: "Rotate",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "OP070-1",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
				{
					value: "OP070-2",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
				{
					value: "东跨OP070北侧端工位1",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "东跨OP070北侧端工位2",
					type: "Rotate",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
			]
			break;
		case 19:
			// 67
			arr = [{
				value: "OP100",
				type: "L_U_R",
				x: 110,
				y: 215,
				mold: '16T'
			}, ]
			break;
		case 20:
			// 81
			arr = [{
					value: "OP110罐体与鞍座机器人焊接工位",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				}, //11
			]
			break;
		case 21:
			// 82-84
			arr = [{
					value: "OPO150-1",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
				{
					value: "OPO150-2",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
				{
					value: "OP155",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
			]
			break;
		case 22:
			// 85-89
			arr = [{
					value: "OP160-1",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
				{
					value: "32T举升机",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				},
				{
					value: "OP160-2",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
				{
					value: "32T缓冲工位",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				},
				{
					value: "32T_Charge",
					type: "Charging",
					x: 110,
					y: 215,
					mold: '32T'
				},
			]
			break;
		case 23:
			// 78-80
			arr = [{
					value: "OP180-1",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				}, //11
				{
					value: "OP180-2",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				}, //11
				{
					value: "OP180-3",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				}, //11
			]
			break;
		case 24:
			// 77
			arr = [{
				value: "16T带货旋转工位",
				type: "Rotate",
				x: 110,
				y: 215,
				mold: '16T'
			}, ]
			break;
		case 25:
			// 76
			arr = [{
				value: "OP145",
				type: "L_U_R",
				x: 110,
				y: 215,
				mold: '16T'
			}, ]
			break;
		case 26:
			// 74-75
			arr = [{
					value: "东跨OP130鹅颈槽料框",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				},
				{
					value: "OP130",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
			]
			break;
		case 27:
			// 72-73
			arr = [{
					value: "OP090",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				}, //11
				{
					value: "东跨OP090下端框料框",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				},
			]
			break;
		case 28:
			// 68-71
			arr = [{
					value: "OP120-1",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
				// {
				// 	value: "东侧料框5",
				// 	type: "L_U_R",
				// 	x: 110,
				// 	y: 215,
				// 	mold: '3T'
				// },
				{
					value: "OP020罐体附件存储区东跨1",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "OP120-2",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
				{
					value: "OP020东跨罐体附件存储区",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				},
			]
			break;
		case 29:
			// 94-113 /166/167
			arr = [{
					value: "缓存区NP080加强圈料框1",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "缓存区NP080加强圈料框2",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "缓存区NP080加强圈料框3",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "缓存区NP080加强圈料框4",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "缓存区NP150管件料框1",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "缓存区NP150管件料框2",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "缓存区NP150管件料框3",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "缓存区NP150管件料框4",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "缓存区NP160管件料框1",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "缓存区NP160管件料框2",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "缓存区NP110防波板料框1",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "缓存区NP110防波板料框2",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "缓存区NP110防波板料框3",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "缓存区NP110防波板料框4",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "缓存区NP130内封头料框1",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "缓存区NP130内封头料框2",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "缓存区NP130内封头料框3",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "缓存区NP130内封头料框4",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "缓存区NP280分子筛料框1",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "缓存区NP280分子筛料框2",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "缓存区NP280分子筛料框3",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "缓存区NP280分子筛料框4",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
			]
			break;
		case 30:
			//117-119
			arr = [{
					value: "OP010-2",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
				{
					value: "NP290-1",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '7T'
				},
				{
					value: "OP030-2",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
				{
					// value: "OP030八点支撑压盖1",
					value: 'OP030中西跨八点支撑压盖',
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				},
			]
			break;
		case 31:
			//120/121
			arr = [{
					value: "NP180内封头料框北侧",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				},
				{
					value: "西跨NP160管件料框1",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
			]
			break;
		case 32:
			//116/115
			arr = [{
					value: "OP030-1",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
				{
					value: "中跨OP030八点支撑压盖",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				},
			]
			break;
		case 33:
			//114
			arr = [{
					value: "OP010-1",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '16T'
				},
				{
					value: "OP010-1",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '7T'
				},
			]
			break;
		case 34:
			//122-124
			arr = [{
					value: "西跨NP150管件料框南工位",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				},
				{
					value: "西跨NP150管件料框北工位",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				},
				{
					value: "NP130西跨内封头料框",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				},
			]
			break;
		case 35:
			//127/128
			arr = [{
					value: "NP210-1",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '7T'
				},
				{
					value: "NP210-2",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '7T'
				},
			]
			break;
		case 36:
			//129/130
			arr = [{
					value: "NP110南侧",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				},
				{
					value: "NP110北侧",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				},
			]
			break;
		case 37:
			//131-133
			arr = [{
					value: "NP080加强圈料框南侧",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				},
				{
					value: "NP080内筒体加强圈与筒体装配点固工位",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '7T'
				}, //11
				{
					value: "NP080加强圈料框北侧",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				},
			]
			break;
		case 38:
			// 126
			arr = [{
				value: "NP220",
				type: "L_U_R",
				x: 110,
				y: 215,
				mold: '7T'
			}, ]
			break;
		case 39:
			// 125
			arr = [{
				value: "NP070",
				type: "L_U_R",
				x: 110,
				y: 215,
				mold: '7T'
			}, ]
			break;
		case 40:
			// 134-135
			arr = [{
					value: "NP260-1",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '7T'
				},
				{
					value: "NP260-2",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '7T'
				},
			]
			break;
		case 41:
			// 136-137
			arr = [{
					value: "NP240-1",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '7T'
				},
				{
					value: "NP240-2",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '7T'
				},
			]
			break;
		case 42:
			// 138-139
			arr = [{
					value: "NP250-1",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '7T'
				},
				{
					value: "NP250-2",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '7T'
				},
			]
			break;
		case 43:
			// 140-145
			arr = [{
					value: "OP170-南1_45尺",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				}, //11
				{
					value: "OP170-南1_40尺",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				}, //11
				{
					value: "OP170-南2_45尺",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				}, //11
				{
					value: "OP170-南2_40尺",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				}, //11
				{
					value: "OP170-南3_45尺",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				}, //11
				{
					value: "OP170-南3_40尺",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				}, //11
			]
			break;
		case 44:
			// 160-165
			arr = [{
					value: "OP170-南4_45尺",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				}, //11
				{
					value: "OP170-南4_40尺",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				}, //11
				{
					value: "OP170-南5_45尺",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				}, //11
				{
					value: "OP170-南5_40尺",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				}, //11
				{
					value: "OP170-南6_45尺",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				}, //11
				{
					value: "OP170-南6_40尺",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				}, //11
			]
			break;
		case 45:
			// 146-159
			arr = [{
					value: "OP170-北1_45尺",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				}, //11
				{
					value: "OP170-北1_40尺",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				}, //11
				{
					value: "OP170-北2_45尺",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				}, //11
				{
					value: "OP170-北2_40尺",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				}, //11
				{
					value: "OP170-北3_45尺",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				}, //11
				{
					value: "OP170-北3_40尺",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				}, //11
				{
					value: "OP170-北4_45尺",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				}, //11
				{
					value: "OP170-北4_40尺",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				}, //11
				{
					value: "OP170-北5_45尺",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				}, //11
				{
					value: "OP170-北5_40尺",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				}, //11
				{
					value: "OP170-北6_45尺",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				}, //11
				{
					value: "OP170-北6_40尺",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				}, //11
				{
					value: "OP170-北7_45尺",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				}, //11
				{
					value: "OP170-北7_40尺",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '32T'
				}, //11
			]
			break;
		case 46:
			// 90-91
			arr = [{
					value: "3T充电桩",
					type: "Charging",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "7吨充电桩",
					type: "Charging",
					x: 110,
					y: 215,
					mold: '7T'
				}, //11
			]
			break;
		case 47:
			// 92-93
			arr = [{
					value: "3T-封头_中跨西侧",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '3T'
				}, //11
				{
					value: "NP270内容器外表面激光清理工位",
					type: "L_U_R",
					x: 110,
					y: 215,
					mold: '7T'
				}, //11
			]
			break;
	}

	return data = {
		arr,
		x,
		y
	}
}

function getVehiclesName() {
	$('.popup-selectVehicles .popup-main .popup-img-box').html('')
	let val = ``,
		workArr = [],
		arr = []
	vehiclesName = ''
	workArr = getVehiclesinfo()

	workArr.map(item => {
		if (workStationType == 'all') {
			val += `
							<div class="select-img" >
								<div></div>
								<span>${item.name}</span>
								<i>${item.allowedOrderTypes[0]}</i>
							</div>
						`
			arr.push({
				value: item.name,
				type: item.allowedOrderTypes[0]
			})
		} else {
			if (item.allowedOrderTypes[0] == workStationType) {
				val += `
							<div class="select-img" >
								<div></div>
								<span>${item.name}</span>
								<i>${item.allowedOrderTypes[0]}</i>
							</div>
						`
				arr.push({
					value: item.name,
					type: item.allowedOrderTypes[0]
				})
			}
		}

	})
	if (arr.length == 1) {
		vehiclesName = arr[0].value
		let type = arr[0].type
		// getOrder()
		onceOrdel(type)
	} else {
		$('.popup-selectVehicles .popup-main .popup-img-box').html(val)
		$('.popup-selectVehicles').show()
	}

}

function onceOrdel(type) {
	if (vehiclesType) {
		if (vehiclesType == 1) {
			goCharge(type)
		} else if (vehiclesType == 2) {
			emergencyStop()
		} else if (vehiclesType == 3) {
			withdrawal(vehiclesName)
		} else if (vehiclesType == 4) {
			getOrder()
		} else if (vehiclesType == 5) {
			switchWorkType()
		} else if (vehiclesType == 6) {
			console.log(666);
		}
	} else {
		let i = vehiclesName.indexOf('_')
		let e = vehiclesName.slice(0, i)
		if (e === '3T') {
			$('.action-list .pattern-btn.active .second-box.three .three-box .second-list .btn-box .h').hide()
		} else {
			$('.action-list .pattern-btn.active .second-box.three .three-box .second-list .btn-box .h').show()
		}
	}
	$('.popup-selectVehicles').hide()
	vehiclesType = 0
}
//  一建充电
function goCharge(workstation) {
	$.ajax({
		url: `http://${ipValue}:55200/v1/transportOrderToRechargeWithType/${vehiclesName}?orderType=${workstation}`,
		contentType: "multipart/form-data",
		data: '',
		type: "post",
		dataType: "json",
		success: (res) => {
			if (res.code == 200) {
				toastText('创建成功')
				rollIngOrder()
			} else {
				toastText(res.msg)
				// $('.operate-box .btn-list .btn-box').eq(index).removeClass(
				// 		'active')
				return false
			}
		},
		timeout: timeOut,
		error: () => {
			overTime()
		}
	})
}

// 急停
function emergencyStop() {
	$.ajax({
		url: `http://${ipValue}:55200/v1/vehicle/emergency/${vehiclesName}`,
		contentType: "multipart/form-data",
		params: vehiclesName,
		type: "post",
		dataType: "json",
		success: (res) => {
			toastText('急停成功')
			$('.new-btn-box .stop-box').addClass('active')
			rollIngOrder()
			// setTimeout(removeActive, 3000)
		},
		timeout: timeOut,
		error: () => {
			overTime()
		}
	})

	function removeActive() {
		$('.new-btn-box .stop-box').removeClass('active')
	}
}


// 取消订单
function withdrawal(vehicles) {
	let url = ''
	if (vehicles == '所有车辆') {
		url = ` http://${ipValue}:55200/v1/transportOrders/withdrawal/all?immediate=true&disableVehicle=false`
	} else {
		url = `http://${ipValue}:55200/v1/vehicles/${vehicles}/withdrawal?immediate=true&disableVehicle=false`
	}
	$.ajax({
		url,
		contentType: "multipart/form-data",
		data: '',
		type: "post",
		dataType: "json",
		success: (res) => {
			toastText('取消成功')
			rollIngOrder()

		}
	})
}
